package com.leadingsoft.pwxk.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.leadingsoft.pwxk.converter.FileDetailConverter;
import com.leadingsoft.pwxk.dto.FileDetailDto;
import com.leadingsoft.pwxk.model.FileDetail;
import com.leadingsoft.pwxk.service.FileDetailService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(description = "发证信息-相关附件")
@RestController
@RequestMapping("api/fileDetail")
public class FileDetailController {

	@Autowired
	FileDetailService fileDetailService;

	@Autowired
	FileDetailConverter fleDetailConverter;

	@ApiOperation("许可证信息的相关附件")
	@GetMapping(path = "{dataId}")
	@ResponseStatus(code = HttpStatus.OK)
	public List<FileDetailDto> getListFile(@PathVariable(value = "dataId") String dataId) {
		List<FileDetail> result = fileDetailService.getList(dataId);
		return fleDetailConverter.toListDto(result);

	}

}
